package com.bootdo.hjh.service;

import java.util.List;

import com.bootdo.hjh.domain.OrderDO;
import com.bootdo.hjh.domain.WithdrawDO;
import com.bootdo.shop.domain.OrderInfo;
import com.bootdo.system.domain.UserDO;

public interface OrderService {

    /**
     * 创建订单
     *
     * @param createUserId  直推人ID
     * @param userId        订单所属用户ID
     * @param productId     产品ID
     * @param quantity      购买数量
     * @param userAddressId 地址ID
     *
     * @return
     */
    public Integer createOrder(Long createUserId, Long userId, Integer productId, Integer quantity,
                               Integer userAddressId, Long frUserId);

    /**
     * 未支付订单
     *
     * @param userId
     *
     * @return
     */
    public List<OrderDO> unpaidOrderList(Long userId);

    /**
     * 我的订单
     *
     * @param userId
     *
     * @return
     */
    public List<OrderDO> myOrderList(Long userId);

    /**
     * 会员 订单
     *
     * @param userId
     *
     * @return
     */
    public List<OrderDO> memberOrderList(Long userId);

    /**
     * 发货订单
     */
    List<OrderDO> deliverOrderList(Long userId);

    /**
     * 获取订单详情
     *
     * @param orderId
     *
     * @return
     */
    public OrderDO getOrderById(Integer orderId);

    /**
     * 获取订单详情
     *
     * @param orderId
     *
     * @return
     */
    public OrderDO getOrderByNo(String orderNo);

    /**
     * 标记订单为已支付
     *
     * @param orderNo
     *
     * @return
     */
    public Integer updateOrderToPaid(String orderNo, String payChannel);

    /**
     * 更新订单号
     *
     * @param orderNo
     *
     * @return
     */
    public Integer updateOrderNo(Integer orderId);

    public Integer updateOrderAmount(String orderNo);

    List<OrderDO> queryOrder(Integer offset, Integer limit, String orderNo, String mobile, String receiver,
                             Integer status);

    int countOrder(String orderNo, Integer status, String mobile, String receiver);

    int updateStatus(Integer id, Integer status);

    List<WithdrawDO> queryWithdraw(Integer offset, Integer limit, Integer status, Long userId);

    int countWithdraw(Integer status, Long userId);

    int updateWithdrawStatus(Integer id, Integer status);

    int cashPay(UserDO payUser, OrderDO orderDO);

    public int shopCashPay(UserDO payUser, OrderInfo orderInfo);

    /**
     * 获取用户对应的价格
     * @param userId
     * @return
     */
    public long getPrice(long userId, int type);

    /**
     * 创建补货单
     * @param createUserId
     * @param frUserId
     * @param quantity
     * @return
     */
    Integer createBuhuoOrder(Long createUserId, Long frUserId, int quantity, int type);

    /**
     * 创建升级代理订单
     * @return
     */
    Integer createUpgradeOrder(Long userId, Long frUserId, boolean needFr);
}
